import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:nyh_motorcade_app/styles/colors.dart';

class LeftRightText extends StatelessWidget {
  final Color background;
  final EdgeInsetsGeometry? padding;
  final String? textLeft;
  final String? textRight;
  final TextStyle? textStyleLeft;
  final TextStyle? textStyleRight;
  final GestureTapCallback? onTap;

  LeftRightText({
    this.background = Colours.white,
    this.padding,
    required this.textLeft,
    required this.textRight,
    this.textStyleLeft,
    this.textStyleRight,
    this.onTap,
  });

  @override
  Widget build(BuildContext context) {
    return Container(
      color: background,
      child: Padding(
        padding: padding ?? EdgeInsets.symmetric(vertical: 17.w, horizontal: 16.w),
        child: Row(
          mainAxisAlignment: MainAxisAlignment.spaceBetween,
          children: [
            Text(
              textLeft ?? "",
              style: textStyleLeft ??
                  TextStyle(
                    color: Colours.color_6f7082,
                    fontSize: 14.sp,
                  ),
            ),
            SizedBox(
              width: 10.w,
            ),
            onTap == null
                ? Expanded(
                    child: Text(
                      textRight ?? "",
                      style: textStyleRight ??
                          TextStyle(
                            color: Colours.color_text_theme,
                            fontSize: 14.sp,
                          ),
                      textAlign: TextAlign.right,
                    ),
                  )
                : GestureDetector(
                    onTap: onTap,
                    child: Text(
                      textRight ?? "",
                      style: textStyleRight ??
                          TextStyle(
                            color: Colours.color_007aff,
                            fontSize: 14.sp,
                          ),
                      textAlign: TextAlign.right,
                    ),
                  ),
          ],
        ),
      ),
    );
  }
}
